package com.example.springboot.utils;


import com.example.springboot.domain.Admin;

public final class ThreadLocalUtil {

    private ThreadLocalUtil(){}

    private  static  final ThreadLocal<Admin> requestHolder=new ThreadLocal<>();

    private  static  final ThreadLocal<Object> requestHolder2=new ThreadLocal<>();

    public static void set(Admin admin){
        requestHolder.set(admin);
    }

    public static Admin get(){
        return requestHolder.get();
    }

    public static String getName(){
        return requestHolder.get().getNickName();
    }

    public static void remove(){
        requestHolder.remove();
    }

    public static void setObject(Object data){requestHolder2.set(data);}

    public static Object getObject(){
        return requestHolder2.get();
    }

    public static void removeObject(){
        requestHolder2.remove();
    }
}